﻿// Copyright (c) 2012 - 2020 Jared Zheng <jaredz at outlook dot com>
// Buddha Framework is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//          http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//
// Create : 2012-12-01 version 0.1 Jared Zheng <jaredz at outlook dot com>
// Update : 2018-12-05 version 3.1.5 Jared Zheng <jaredz at outlook dot com>

#ifndef __CENTER_HANDLER_H__
#define __CENTER_HANDLER_H__

#pragma once

#include "CommonHandler.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// 同步管理服务器处理
class CCenterHandler : public CCommonHandler
{
public:
    CCenterHandler(void);
    virtual ~CCenterHandler(void);
private:
    virtual void OnLive(bool bStart) OVERRIDE;
    virtual void OnLink(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnUpdate(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnSync(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnSync(Int nServerIndex, CStream& Stream) OVERRIDE;
    virtual void OnUnlink(Int nServerIndex, uintptr_t utData) OVERRIDE;

    virtual void UpdateServerInfo(void) OVERRIDE;

    virtual PCXStr GetName(void) OVERRIDE;
private:
    UInt   m_uCenterOnline;
    UInt   m_uCenterTotal;
    UInt   m_uCenterLoad;
    UInt   m_uBalanceCount;
    UInt   m_uBalanceAddr;
    UInt   m_uBalanceNotice;
    UInt   m_uAuthorDBCount;
    UInt   m_uAuthorDBServer;
    UInt   m_uAuthorDBQuery;
    UInt   m_uAuthorCount;
    UInt   m_uAuthorOnline;
    UInt   m_uAuthorTotal;
    UInt   m_uMasterDBCount;
    UInt   m_uMasterDBServer;
    UInt   m_uMasterDBQuery;
    UInt   m_uMasterCount;
    UInt   m_uMasterGate;
    UInt   m_uMasterService;
};

#endif // __CENTER_HANDLER_H__
